-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-143635: Fix crash in _Py_typing_type_repr
#143670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
This needs NEWS since it fixes a user-visible crash. |
JelleZijlstra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this is incorrect. The crash can be triggered if the list is cleared while we're iterating over it in ga_repr_items_list. INCREFing here is insufficient to protect us because the item may not be valid in the first place any more by the time we receive it.
My repro case in #143823 makes this clearer.
|
When you're done making the requested changes, leave the comment: |
|
Thank you! I refactored the PR to include the fix for the third case. |
a811a1d to
4e08352
Compare
I also added one more test case for a second possible crash in the same function.
_Py_typing_type_reprvia re-entrant__origin__lookup duringGenericAliasrepr #143635